#include <QMessageBox>
#include "launchermainwindow.h"
#include "ui_launchermainwindow.h"

LauncherMainWindow::LauncherMainWindow(QWidget *parent)
    : QDialog(parent), ui(new Ui::LauncherMainWindow)
{
    ui->setupUi(this);
}

LauncherMainWindow::~LauncherMainWindow()
{
    delete ui;
}

void LauncherMainWindow::fileLoadingStart(const QString &message)
{
	ui->progressBar->setValue(0);
	ui->progressBar->show();
	ui->label->setText(message);
        if(this->isHidden())show();
}

void LauncherMainWindow::fileLoadingDone(const QString &message)
{
	ui->progressBar->hide();
}

void LauncherMainWindow::fileSizeInit(int min, int max)
{
	ui->progressBar->setRange(min, max);
}

void LauncherMainWindow::fileLoadingProgress(int v)
{
	ui->progressBar->setValue(v);
}

void LauncherMainWindow::unhandledError(const QString &msg)
{
	QMessageBox::critical(this, windowTitle(), msg);
}
